
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 09/25/2011 20:52:52
-- Generated from EDMX file: D:\_Perso\_Projets\_Biwo\Biwo\Biwo\Samples\SQLServer\Repository\BiwoSample.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [BiwoSample];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO

-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------


-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------


-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------

-- Creating table 'PersonneSet'
CREATE TABLE [dbo].[PersonneSet] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Nom] nvarchar(max)  NOT NULL,
    [Prenom] nvarchar(max)  NOT NULL,
    [Adresse] nvarchar(max)  NOT NULL,
    [CodePostal] nvarchar(max)  NOT NULL,
    [Ville] nvarchar(max)  NOT NULL
);
GO

-- Creating table 'PersonneSet_Client'
CREATE TABLE [dbo].[PersonneSet_Client] (
    [NumeroCarteFidelite] nvarchar(max)  NOT NULL,
    [Id] int  NOT NULL
);
GO

-- Creating table 'PersonneSet_Fournisseur'
CREATE TABLE [dbo].[PersonneSet_Fournisseur] (
    [RemiseGlobale] float  NOT NULL,
    [Id] int  NOT NULL
);
GO

-- --------------------------------------------------
-- Creating all PRIMARY KEY constraints
-- --------------------------------------------------

-- Creating primary key on [Id] in table 'PersonneSet'
ALTER TABLE [dbo].[PersonneSet]
ADD CONSTRAINT [PK_PersonneSet]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'PersonneSet_Client'
ALTER TABLE [dbo].[PersonneSet_Client]
ADD CONSTRAINT [PK_PersonneSet_Client]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'PersonneSet_Fournisseur'
ALTER TABLE [dbo].[PersonneSet_Fournisseur]
ADD CONSTRAINT [PK_PersonneSet_Fournisseur]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- --------------------------------------------------
-- Creating all FOREIGN KEY constraints
-- --------------------------------------------------

-- Creating foreign key on [Id] in table 'PersonneSet_Client'
ALTER TABLE [dbo].[PersonneSet_Client]
ADD CONSTRAINT [FK_Client_inherits_Personne]
    FOREIGN KEY ([Id])
    REFERENCES [dbo].[PersonneSet]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [Id] in table 'PersonneSet_Fournisseur'
ALTER TABLE [dbo].[PersonneSet_Fournisseur]
ADD CONSTRAINT [FK_Fournisseur_inherits_Personne]
    FOREIGN KEY ([Id])
    REFERENCES [dbo].[PersonneSet]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------